package Tools
{
	public class HtmlTool
	{
		public static const HTML_TEXT_SET:Object={};
		HTML_TEXT_SET["b"]="<b>{text}</b>";
		HTML_TEXT_SET["font"]="<font size='{size}' face='{face}' color='{color}'>{text}</font>";
		HTML_TEXT_SET["u"]="<u>{text}</u>";
		HTML_TEXT_SET["li"]="<li>{text}</li>";
		HTML_TEXT_SET["a"]="<a href='{href}' target='{target}'>{text}</a>";
		HTML_TEXT_SET["br"]="{text}<br>";
		HTML_TEXT_SET["i"]="<i>{text}</i>";
		HTML_TEXT_SET["img"]="<img src='{src}' width='{width}' height='{height}' hspace='{hspace}' vspace='{vspace}' id='{id}' checkPolicyFile='{checkPolicyFile}'/>";
		HTML_TEXT_SET["p"]="<p align='{align}'>{text}</p>";
		
		public function HtmlTool()
		{
			super();
		}
		
		public static function underline(text:String):String
		{
			var html:String=HTML_TEXT_SET["u"];
			html=html.replace("{text}",text);
			return html;
		}
		public static  function bold(text:String):String
		{
			var html:String=HTML_TEXT_SET["b"];
			html=html.replace("{text}",text);
			return html;
		}
		public static function href(text:String,href:String,target:String="_blank"):String
		{
			var html:String=HTML_TEXT_SET["a"];
			html=html.replace("{href}",href);
			html=html.replace("{target}",target);
			html=html.replace("{text}",text);
			return html;
		}
		public static function list(text:String):String
		{
			var html:String=HTML_TEXT_SET["li"];
			html=html.replace("{text}",text);
			return html;
		}
		public static function font(text:String,color:Object=null,size:Object=null,face:String="宋体"):String
		{
			var html:String=HTML_TEXT_SET["font"];
			html=html.replace("{color}",color);
			html=html.replace("{size}",size);
			html=html.replace("{face}",face);
			html=html.replace("{text}",text);
			return html;
		}
		public static function newline(text:String):String
		{
			var html:String=HTML_TEXT_SET["br"];
			html=html.replace("{text}",text);
			return html;
		}
		public static function italic(text:String):String
		{
			var html:String=HTML_TEXT_SET["i"];
			html=html.replace("{text}",text);
			return html;
		}
		public static function paragraph(text:String,align:String="left"):String
		{
			var html:String=HTML_TEXT_SET["p"];
			html=html.replace("{align}",align);
			html=html.replace("{text}",text);
			return html;
		}
		
		public static function img(src:String,width:Number,height:Number,align:String="left",hspace:Number=0,vspace:Number=0,id:String="",checkPolicyFile:Boolean=false):String
		{
			var html:String=HTML_TEXT_SET["img"];
			html=html.replace("{src}",src);
			html=html.replace("{width}",width);
			html=html.replace("{height}",height);
			html=html.replace("{align}",align);
			html=html.replace("{hspace}",hspace);
			html=html.replace("{vspace}",vspace);
			html=html.replace("{id}",id);
			html=html.replace("{checkPolicyFile}",checkPolicyFile);
			return html;
		}
	}
}